#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
#include <string.h>
int main()
{
	char a[101] = { 0 };
	char b[101] = { 0 };
	int cn = 0;
	while ((a[cn] = getchar()) != '\n')
	{
		cn++;
	}
	a[cn] = '\0';
	int right = cn - 1;
	int temp = right;
	printf("%s\n", a);
	int i = 0;
	int we = 0;
	while (1)
	{
		int flag = 0;
		for (i = right; i >= 0; i--)
		{
			if (a[i] == ' ')
			{
				flag = 1;
				break;
			}
		}
		if (flag)
		{
			int j = 0;
			for (j = i + 1; j <= right; j++)
			{
				b[we] = a[j];
				we++;
			}
			b[we] = ' ';
			we++;
		}
		else
		{
			int j = 0;
			for (j = i + 1; j <= right; j++)
			{
				b[we] = a[j];
				we++;
			}
			b[we] = '\0';
			break;
		}
		right = i - 1;
	}
	printf("%s\n", b);
	return 0;
}